.container
  .ui.grid
    .row
      .four.wide.column
        = render partial: 'admin/innoawards/sidebar', locals: { inno: @innoaward }
      .twelve.wide.column
        .ui.borderless.menu
          .item.header
            | 报名产品
          a.item.ui.button href=new_admin_innoaward_product_path(@innoaward)
            | 添加
          .ui.search.right.item#search-input data-url=search_admin_innoaward_products_path(@innoaward)
            .ui.transparent.icon.input
              input type='text' placeholder='产品名称' v-model='query' v-on="keyup:submit | debounce 300"
              i.search.icon
        .ui.borderless.menu
          a.item href=admin_innoaward_products_path
            | 全部
            .ui.left.pointing.label
              =@products.count
          a.item href="#{admin_innoaward_products_path}?status=waiting"
            | 待审核
            .ui.teal.left.pointing.label
              =@products.with_status(:waiting).count
          a.item href="#{admin_innoaward_products_path}?status=approved"
            | 已通过
            .ui.green.left.pointing.label
              =@products.with_status(:approved).count
          a.item href="#{admin_innoaward_products_path}?status=unapproved"
            | 已拒绝
            .ui.red.left.pointing.label
              =@products.with_status(:unapproved).count

        table.ui.celled.table
          thead
            tr
              th.one.wide Logo
              th.three.wide 名称
              th.two.wide 类型
              /th.two.wide 简介
              th.two.wide 提交时间
              th.two.wide 状态
              th.five.wide 操作
          tbody#result
            tr v-repeat='p in products'
              td
                img src="{{p.logo}}" class='logo'
              td
                a href='{{p.edit_path}}' {{p.name}}
              td 
                ="{{p.category}}"
              td 
                ="{{p.created_at}}"
              td 
                ="{{p.status}}"
              td
                a href='javascript:;' v-on='click: approve(p.id, "approved", $index)'
                  | 通过
                | /
                a href='javascript:;' v-on='click: approve(p.id, "unapproved", $index)'
                  | 拒绝
                | /
                a.choosen href='javascript:;' data-pro-id='{{p.id}}'
                  | 参选
                | /
                a href='{{p.edit_path}}'
                  | 编辑
                | /
                a href='{{p.path}}' data-method='delete' data-confirm='确认删除?'
                  | 删除

        = paginate @products

  .ui.modal#choosen-modal
    i.close.icon
    .header
      | 选择参选奖项
    .content
      = form_tag [:admin, Rank.new], class: 'ui form', id: 'rankForm' do |f|
        .required.field
          = collection_check_boxes :rank, :award_ids, Award.where(innoaward_id: @innoaward.id), :id, :name do |c|
            .field.award-item
              .ui.checkbox
                = c.check_box
                = c.label
          = hidden_field_tag 'rank[product_id]'
          = hidden_field_tag :multi, true
    .actions
      .field
        = submit_tag '提交', class: 'ui blue button', id: 'rankSubmit'

